package com.kuizii.base.api.config;

import com.kuizii.base.api.FeignErrorDecoder;
import feign.Feign;
import feign.Logger;
import feign.codec.ErrorDecoder;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: nuanyang
 * @Date: 2019/7/29 0029 15:58
 */
@Configuration
@ConditionalOnClass(Feign.class)
public class FeignConfig {
    /**
     * 日志level有4个级别 * 1.NONE，不记录任何日志 * 2.BASIC，仅记录请求方法、URL以及响应状态码和执行时间 * 3.HEADRES，除了BASIC以外的还会记录请求和响应的头信息 * 4.FULL,所有 * @return
     */
    @Bean
    Logger.Level feignLogger() {

        return Logger.Level.FULL;
    }

    @Bean
    ErrorDecoder feignErrorDecoder() {

        return new FeignErrorDecoder   ();
    }
}
